package com.k1998.mybatis.controller;

import com.k1998.mybatis.bean.Journalism;
import com.k1998.mybatis.service.impl.JournalismImpl;
import com.k1998.mybatis.utils.BatchInfo;
import com.k1998.mybatis.utils.QueryInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Api(tags = {"新闻Api文档"})
public class JournalismController {
    @Autowired
    private JournalismImpl journalismImpl;
    @PostMapping("/getAllJournalism")
    @ApiOperation(value = "查询", notes="查询", httpMethod = "POST")
    public String getAllJournalism(@RequestBody QueryInfo queryInfo){
        return journalismImpl.findJournalism(queryInfo);
    }
    @PostMapping("/insertJournalism")
    public String insertJournalism(@RequestBody Journalism journalism){
        return journalismImpl.insertJournalism(journalism)>0?"success":"error";
    }
    @PostMapping("/batchDeleteJournalism")
    public String batchDeleteJournalism(@RequestBody BatchInfo info){
        return journalismImpl.batchDeleteJournalism(info)>0?"success":"error";
    }
    @PostMapping("/updateJournalismById")
    public String updateJournalismById(@RequestBody Journalism journalism){
        return journalismImpl.updateJournalismById(journalism)>0?"success":"error";
    }
    @PostMapping("/getJournalismById")
    public String getJournalismById(@RequestBody Journalism journalism){
        return journalismImpl.getJournalismById(journalism);
    }
}
